package com.powerteam.util;


import java.util.ArrayList;
import java.util.List;

/**
 * 对象转列表工具
 *
 * @author jinming.zhang
 * @version 0.0.1
 * @date 2022/01/11
 */
public class ObjToListUtil {

    public static <T> List<T> objToList(Object obj, Class<T> cla) {

        List<T> list = new ArrayList<>();
        if (obj instanceof List<?>) {
            for (Object o : (List<?>) obj) {
                list.add(cla.cast(o));
            }
            return list;
        }
        return null;
    }

}
